inherits(baselogin.View);

function Controller(model, mainapp) {
    base(this, arguments)();
    this.model = model;
    this.mainapp = mainapp;
}

function onLoginFormSubmit() {
    this.model.login(this.username.getValue(),  this.password.getValue(), this.mainapp, function(data) {

        if(data.sucess == true) {
            workspace.menu.clear();
            workspace.menu.add(data.menu);
            workspace.loadApplication(this.mainapp, data.home);
            workspace.setIsLogin(true);
        } else {
            alert("Usuario o contraseña incorrecto");
        }
        
    }.bind(this));
}